package com.dashen.sso.server.config.runner;

import org.springframework.beans.BeansException;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import javax.servlet.Filter;


/**
 * @author Barry Wang
 */
@Component
public class DaShenApplicationRunner implements ApplicationRunner, ApplicationContextAware {

    public ApplicationContext applicationContext;


    @Override
    public void run(ApplicationArguments args) throws Exception {

        try {
//            Filter filter = (Filter)applicationContext.getBean("springSecurityFilterChain");
//            System.out.println(filter);
//
//            Object obj = applicationContext.getBean(Filter.class);
//            System.out.println(obj);
        } catch (BeansException e) {
            e.printStackTrace();
        }

    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
}
